import {observable, computed, action} from 'mobx'
import {createContext} from 'react'
import ChildrenPageUtils from '@/store/extends'
import {toHome} from '@/utils/pageRedirect'

class Wxscanauth extends ChildrenPageUtils {
  @observable toHomeTimer: NodeJS.Timeout | null = null
  @action.bound
  openToHome() {
    this.closeToHome()
    this.toHomeTimer = setTimeout(() => {
      toHome()
    }, 1000)
  }
  @action.bound
  closeToHome() {
    if (this.toHomeTimer) clearTimeout(this.toHomeTimer)
  }

  @computed get getData() {
    return null
  }
}
export const wxScanAuthStore = createContext(new Wxscanauth())
